<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>登录页面</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="/static/plugins/fontawesome-free/css/all.min.css">
  <!-- icheck bootstrap -->
  <link rel="stylesheet" href="/static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
  <!-- /.login-logo -->
  <div class="card card-outline card-primary">
    <span class="brand-text font-weight-light" style="font-size:20px;text-align: center;margin-bottom: 30px;margin-top: 30px;">白泽安全知识图谱平台</span>
    <div class="card-body">

      <form action="." method="post" id="loginForm">
          {% csrf_token %}
        <div class="input-group mb-3">
          <input type="text" class="form-control" placeholder="Username" name="username">
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas  fa-user"></span>
            </div>
          </div>
        </div>
        <div class="input-group mb-3">
          <input type="password" class="form-control" placeholder="Password" name="password">
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas fa-lock"></span>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-8">
            <div class="icheck-primary">
              <input type="checkbox" id="remember">
              <label for="remember">
                Remember Me
              </label>
            </div>
          </div>
          <!-- /.col -->
          <div class="col-4">
            <button type="submit" class="btn btn-primary btn-block">Sign In</button>
          </div>
          <!-- /.col -->
        </div>
        <div id="warnPlace" style="display:none;color:red">
            <span>用户名或密码错误</span>
        </div>
      </form>
    </div>
    <!-- /.card-body -->
  </div>
  <!-- /.card -->
</div>
<!-- /.login-box -->

<!-- jQuery -->
<script src="/static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/dist/js/adminlte.min.js"></script>
<script src="/static/plugins/iCheck/icheck.min.js"></script>
<script src="/static/js/jquery.form.js"></script>
<script>
  {#$(function () {#}
  {#  $('input').iCheck({#}
  {#    checkboxClass: 'icheckbox_square-blue',#}
  {#    radioClass: 'iradio_square-blue',#}
  {#    increaseArea: '20%' // optional#}
  {#  });#}
  {#});#}
  $("#loginForm").ajaxForm({
    success: function(data){
        if (!data.success){
            $("#warnPlace").css("display", "block")
        }else{
            location.href="/home/"
        }
    }
  })
</script>
</body>
</html>
